
#include "nx_api.h"

#ifdef __PRODUCT_NETXDUO__
#include "netx_mdns_test.h"
/* Frame (76 bytes) */
static const unsigned char pkt1[76] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */
0x00, 0x3e, 0x00, 0x07, 0x40, 0x00, 0xff, 0x11, /* .>..@... */
0xd9, 0xc1, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2a, /* .......* */
0x2c, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* ,....... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01                          /* .... */
};

/* Frame (153 bytes) */
static const unsigned char pkt2[153] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x1e, /* ..^..... */
0x8f, 0xb1, 0x7a, 0xd4, 0x08, 0x00, 0x45, 0x00, /* ..z...E. */
0x00, 0x8b, 0x7e, 0xd1, 0x00, 0x00, 0xff, 0x11, /* ..~..... */
0x9a, 0xe8, 0xc0, 0xa8, 0x00, 0x04, 0xe0, 0x00, /* ........ */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x77, /* .......w */
0xe2, 0xa6, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, /* ........ */
0x00, 0x0f, 0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, /* ...Canon */
0x4d, 0x46, 0x34, 0x35, 0x30, 0x30, 0x77, 0xc0, /* MF4500w. */
0x0c, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, /* ..router */
0xc0, 0x17, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, 0x00, 0x04, /* .x...... */
0xc0, 0x28, 0x00, 0x21, 0x80, 0x01, 0x00, 0x00, /* .(.!.... */
0x00, 0x78, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /* .x...... */
0x00, 0x50, 0xc0, 0x37, 0xc0, 0x28, 0x00, 0x10, /* .P.7.(.. */
0x80, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x01, /* ........ */
0x00                                            /* . */
};

/* Frame (135 bytes) */
static const unsigned char pkt3[135] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */
0x00, 0x79, 0x00, 0x08, 0x40, 0x00, 0xff, 0x11, /* .y..@... */
0xd9, 0x85, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x65, /* .......e */
0x31, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 1....... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0x05, 0x5f, 0x68, 0x74, /* ....._ht */
0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */
0x00, 0x01, 0x00, 0x00, 0x11, 0x93, 0x00, 0x1f, /* ........ */
0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */
0x34, 0x35, 0x30, 0x30, 0x77, 0x05, 0x5f, 0x68, /* 4500w._h */
0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ttp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00        /* .local. */
};

/* Frame (135 bytes) */
static const unsigned char pkt4[135] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */
0x00, 0x79, 0x00, 0x09, 0x40, 0x00, 0xff, 0x11, /* .y..@... */
0xd9, 0x84, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x65, /* .......e */
0x31, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 1....... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0x05, 0x5f, 0x68, 0x74, /* ....._ht */
0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */
0x00, 0x01, 0x00, 0x00, 0x11, 0x91, 0x00, 0x1f, /* ........ */
0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */
0x34, 0x35, 0x30, 0x30, 0x77, 0x05, 0x5f, 0x68, /* 4500w._h */
0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ttp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00        /* .local. */
};

/* Frame (135 bytes) */
static const unsigned char pkt5[135] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */
0x00, 0x79, 0x00, 0x0a, 0x40, 0x00, 0xff, 0x11, /* .y..@... */
0xd9, 0x83, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x65, /* .......e */
0x31, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 1....... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0x05, 0x5f, 0x68, 0x74, /* ....._ht */
0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */
0x00, 0x01, 0x00, 0x00, 0x11, 0x8d, 0x00, 0x1f, /* ........ */
0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */
0x34, 0x35, 0x30, 0x30, 0x77, 0x05, 0x5f, 0x68, /* 4500w._h */
0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ttp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00        /* .local. */
};

/* Frame (135 bytes) */
static const unsigned char pkt6[135] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x11, /* ..^..... */
0x22, 0x33, 0x44, 0x56, 0x08, 0x00, 0x45, 0x00, /* "3DV..E. */
0x00, 0x79, 0x00, 0x0b, 0x40, 0x00, 0xff, 0x11, /* .y..@... */
0xd9, 0x82, 0xc0, 0xa8, 0x00, 0x42, 0xe0, 0x00, /* .....B.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x65, /* .......e */
0x31, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 1....... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0x05, 0x5f, 0x68, 0x74, /* ....._ht */
0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, 0x05, /* tp._tcp. */
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, /* local... */
0x00, 0x01, 0x00, 0x00, 0x11, 0x85, 0x00, 0x1f, /* ........ */
0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */
0x34, 0x35, 0x30, 0x30, 0x77, 0x05, 0x5f, 0x68, /* 4500w._h */
0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, 0x70, /* ttp._tcp */
0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00        /* .local. */
};

static MDNS_QUERY_INFO mdns_query = {NX_NULL, "_http._tcp", NX_NULL};

MDNS_TEST_SEQ mdns_continuous_query[] = {
    {TITLE, "Continuous query", 16, 0},
    
    {MDNS_QUERY, (char*)&mdns_query, 0, 0},

    /* Check query. */
    {MDNS_CHECK_DATA_V4, (char*)&pkt1[0], sizeof(pkt1), 1},

    /* Inject response. */
    {INJECT, (char*)&pkt2[0], sizeof(pkt2), 0},

    /* Check query with known answer. */
    {MDNS_CHECK_DATA_V4, (char*)&pkt3[0], sizeof(pkt3), 1},
    {MDNS_CHECK_DATA_V4, (char*)&pkt4[0], sizeof(pkt3), 2},
    {MDNS_CHECK_DATA_V4, (char*)&pkt5[0], sizeof(pkt3), 4},
    {MDNS_CHECK_DATA_V4, (char*)&pkt6[0], sizeof(pkt3), 8},
};

int mdns_continuous_query_size = sizeof(mdns_continuous_query) / sizeof(MDNS_TEST_SEQ);

#endif /* __PRODUCT_NETXDUO__  */
